{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "dotnet_interactive": {
     "language": "csharp"
    },
    "polyglot_notebook": {
     "kernelName": "csharp"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><div></div><div></div><div><strong>Installed Packages</strong><ul><li><span>Figgle, 0.5.1</span></li></ul></div></div>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#load \"..\\Extension\\LoadBaseTool.csx\"\n",
    "#r \"nuget: Figgle\"\n",
    "using Figgle;"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "dotnet_interactive": {
     "language": "csharp"
    },
    "polyglot_notebook": {
     "kernelName": "csharp"
    }
   },
   "outputs": [],
   "source": [
    "void FiggleComment(string _target)\n",
    "{\n",
    "    string _figgle_string = FiggleFonts.Slant.Render(_target);\n",
    "    string[] _string_array = _figgle_string.Split(Environment.NewLine);\n",
    "\n",
    "    int[] _length_array = _string_array.Select(_item => _item.Length).ToArray();\n",
    "    int _max_length = _length_array.Max();\n",
    "    _max_length.Dump();\n",
    "\n",
    "    int _target_length = _target.Length;\n",
    "    int _left_number = (_max_length + 2 - _target_length) / 2;\n",
    "    int _remind = (_max_length + 2 - _target_length) % 2;\n",
    "    string _head = $\"/{new string('*',_left_number )} {_target} {new string('*',_left_number + _remind )}/\";\n",
    "\n",
    "    _head.Dump();\n",
    "    foreach(string _item in _string_array)\n",
    "    {\n",
    "        if(_item.Length is 0) continue;\n",
    "        $\"/* {_item} */\".Dump();\n",
    "    }\n",
    "    _head.Dump();\n",
    "}\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "dotnet_interactive": {
     "language": "csharp"
    },
    "polyglot_notebook": {
     "kernelName": "csharp"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "39\n",
      "/***************** ForTest *****************/\n",
      "/*     ______          ______          __  */\n",
      "/*    / ____/___  ____/_  __/__  _____/ /_ */\n",
      "/*   / /_  / __ \\/ ___// / / _ \\/ ___/ __/ */\n",
      "/*  / __/ / /_/ / /   / / /  __(__  ) /_   */\n",
      "/* /_/    \\____/_/   /_/  \\___/____/\\__/   */\n",
      "/*                                         */\n",
      "/***************** ForTest *****************/\n"
     ]
    }
   ],
   "source": [
    "FiggleComment(\"ForTest\");"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": ".NET (C#)",
   "language": "C#",
   "name": ".net-csharp"
  },
  "language_info": {
   "name": "polyglot-notebook"
  },
  "polyglot_notebook": {
   "kernelInfo": {
    "defaultKernelName": "csharp",
    "items": [
     {
      "aliases": [],
      "languageName": "csharp",
      "name": "csharp"
     }
    ]
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
